package cn.snorlaxzjt.LBSserver.mapper;

import cn.snorlaxzjt.LBSserver.po.entity.Friends;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper

@Repository
public interface FriendsMapper extends BaseMapper<Friends>
{
    @Select("select friend_id from friends where user_id=#{id}" )
    List<Integer> getFriendsById(int id);

    @Select("select friend_id from friends where friend_id=#{id}" )
    List<Integer> getFansById(int id);

    @Select("select COUNT(*) from friends where user_id=#{id}")
    Integer getFriendsCount(int id);

    @Select("select COUNT(*) from  friends where user_id=#{aid} and friend_id =#{bid}")
    Integer ifFollow(int aid,int bid);



}
